Ext.namespace('GBIF.GeoSpatial')
	
GBIF.GeoSpatial.WMSCapabilitiesLayers = function(config){	
	var store;
    
    // create a new WMS capabilities store
    store = new GeoExt.data.WMSCapabilitiesStore({
		//	url:""
         url: '../../resources/api/getcapabilities-proxy.php'
		 //url:"wms.xml"
    });
    // load the store with records derived from the doc at the above url
    //store.load();

	Ext.apply(this,config,{
			title: "WMS Capabilities"
        ,	store: store
		,	loadMask:true
        ,	columns: [
	            	{header: "Title", dataIndex: "title", sortable: true}
	            ,	{header: "Name", dataIndex: "name", sortable: true}
	            ,	{header: "Queryable", dataIndex: "queryable", sortable: true, width: 70}
	            ,	{id: "description", header: "Description", dataIndex: "abstract"}
        	]
		,	tbar:[{
						text:'Add Layer'
					,	scope:this
					,	ref:'../addlayer'
					,	handler:this.layerData
				}]	
        

	})
	GBIF.GeoSpatial.WMSCapabilitiesLayers.superclass.constructor.call(this, config)
}
Ext.extend(GBIF.GeoSpatial.WMSCapabilitiesLayers,Ext.grid.GridPanel, {
	
	layerData:function(){
		if (this.getSelectionModel().getSelected()) {
			var rowdata = this.getSelectionModel().getSelected().data;
			this.fireEvent('addLayer', this,rowdata);
			
		}
		
	}
	
})
